package com.miyu.test.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.miyu.common.pojo.cos.CosApiLog;
import com.miyu.common.utils.commonUtils.CommonUtils;
import com.miyu.test.dao.testDao;
import com.miyu.test.service.testService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class testServiceImpl implements testService {

    @Resource
    private testDao tDao;
    @Override
    public void testSave(JSONObject param) {
        CosApiLog cal = new CosApiLog();
        cal.setLogId(CommonUtils.getUUID());
//        cal.setAccountType("1");
        cal.setLogAccount("张三");
        tDao.save(cal);
        System.out.println(param);
    }

    /**
     * 缓存驱逐
     *
     * @return {@code JSONObject}
     */
    @Override
    @CacheEvict(cacheNames = "weather" ,allEntries = true)
    public JSONObject cacheEvict() {
        JSONObject rs = new JSONObject();
        rs.put("msg","删除数据");
        return rs;
    }
}
